<?php include $this->header();?>
<?php if(false) {?>
<link rel="stylesheet" rev="stylesheet" href="../../../images/admincp/style.css" type="text/css" media="all" />
<?php }?>
<a href="index.php?product/brand/add" class="btn-r-top">添加品牌</a>
<form method="post">
  <div class="p1 mt bd bg">
      <table class="list rank" width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr class="th">
          <td align="center" width="50">排序</td>
          <td align="center" width="40">ID</td>
          <td align="left">名称</td>
          <td align="center" width="100">&nbsp;</td>
          <td align="center" width="100">&nbsp;</td>
          <td align="center" width="40">启用</td>
          <td width="210" align="center">管理操作</td>
        </tr>
        <?php foreach ($brands as $brand) {?>
        <tr class="bb">
          <td align="center"><input name="cat_order[<?=$brand['brand_id']?>]" type="text" id="cat_order[<?=$brand['brand_id']?>]" style="text-align:center;" value="<?=$brand['brand_order']?>" size="3"></td>
          <td align="center"><?=$brand['brand_id']?></td>
          <td align="left"><?php if($brand['brand_logo_id']) {?><span style="position:relative"><img id="list-logo-<?=$brand['brand_id']?>" src="<?=thumb($brand['brand_logo_id'], 240, 80)?>" style="position:absolute; left:0px; top:20px; display:none;" /></span><?php }?><span onmouseover="$('#list-logo-<?=$brand['brand_id']?>').show()" onmouseout="$('#list-logo-<?=$brand['brand_id']?>').hide()"><?=$brand['brand_name']?></span></td>
          <td align="center">&nbsp;</td>
          <td align="center" id="cat_nav_show_<?=$brand['brand_id']?>" class="cat_nav_show" onclick="chNavShow(<?=$brand['brand_id']?>);" style="cursor:pointer">&nbsp;</td>
          <td align="center" id="cat_enabled_<?=$brand['brand_id']?>" class="cat_enabled" onclick="chEnabled(<?=$brand['brand_id']?>);" style="cursor:pointer"><?php if($brand['brand_enabled']) {?> <a href="index.php?product/brand/disable/<?=$brand['brand_id']?>" title="点击禁用该品牌"><span class="green">是</span></a><?php } else { ?><a href="index.php?product/brand/enable/<?=$brand['brand_id']?>" title="点击启用该品牌"><span class="red">否</span></a><?php }?></td>
          <td align="center"><a href="index.php?product/show/brand/<?=$brand['brand_id']?>" target="_blank">查看</a> | <a href="index.php?product/brand/edit/<?=$brand['brand_id']?>">编辑</a> |  <?php if($brand['brand_is_trash']) {?><a href="index.php?product/brand/del/<?=$brand['brand_id']?>" onclick="return confirm('您确定要删除该分类吗？一旦删除将不可恢复。')">彻底删除</a> | <a href="index.php?product/brand/trash/<?=$brand['brand_id']?>/untrash/1">还原</a><?php } else {?><a href="index.php?product/brand/trash/<?=$brand['brand_id']?>">删除</a><?php } ?></td>
        </tr>  	
        <?php }?>
      </table>
      <div class="pd"><?=$pagingStr?></div>
  </div>
  <p style=" margin:-30px 0 0 10px;;"><input type="submit" value="排序" class="btn"></p>
</form>
<script type="text/javascript">
//<![CDATA[
function chNavShow(cid) {
	var url = '<?=UE_Url::make("system/category/ajaxChInNav/")?>&id='+cid;
    $.getJSON(url, function(json){
		if(json.err) {
			alert(json.err);
		} else {
			if(json.r == 1) {
				$('#cat_nav_show_'+cid).html('<span class="green">是</span>');
			} else {
			    $('#cat_nav_show_'+cid).html('<span class="red">否</span>');
			}
		}
    });
}

function chEnabled(cid) {
	var url = '<?=UE_Url::make("system/category/ajaxChEnabled/")?>&id='+cid;
    $.getJSON(url, function(json){
		if(json.err) {
			alert(json.err);
		} else {
			if(json.r == 1) {
				$('#cat_enabled_'+cid).html('<span class="green">是</span>');
			} else {
			    $('#cat_enabled_'+cid).html('<span class="red">否</span>');
			}
		}
    });
}
//]]>
</script>
<?php include $this->footer();?>